<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<head>
<title>我的已办任务</title>
<script type="text/javascript">
	var $grid, $nodeGrid;
	var selectTableRow;//选中的行数据
	$(function() {
		$grid = $("#grid")
				.datagrid(
						{
							method : "get",
							url : "${ctx}/bpm/workspace/workspace-listHistoryTasks",
							idField : 'id',
							remoteSort : true,
							multiSort : true,
							rownumbers : true,
							fit : true,
							toolbar : '#tt',
							pagination : true,
							pageList : [ 10, 20, 30, 40, 50, 100 ],
							columns : [ [
									{
										field : 'ck',
										checkbox : true
									},
									{
										field : 'id',
										title : '编号',
										sortable : true
									},
									{
										field : 'promoter',
										title : '发起人',
										sortable : true
									},
									{
										field : 'name',
										title : '任务名称',
										width : 180,
										sortable : true
									},
									{
										field : 'pdname',
										title : '流程名称',
										width : 205
									},
									{
										field : 'createTime',
										title : '创建时间',
										width : 160,
										sortable : true
									},
									{
										field : 'assigneeName',
										title : '负责人',
										sortable : true
									},
									{
										field : 'processInstanceId',
										title : '操作',
										formatter : function(val, row) {
											var result = "<a class='l-btn l-btn-plain' href='#'  onclick='viewHistory(\""
												+ row.id
												+ "\")'><span class='l-btn-left'><span class='l-btn-text icon-hamburg-graphic l-btn-icon-left'>历史</span></span></a>";
											/* result += "<a class='l-btn l-btn-plain' href='#'  onclick='withdrawTask(\""
													+ row.id
													+ "\")'><span class='l-btn-left'><span class='l-btn-text icon-hamburg-bug l-btn-icon-left'>撤销</span></span></a>"; */
											return result;
										}
									} ] ],
							enableHeaderClickMenu : true, //此属性开启表头列名称右侧那个箭头形状的鼠标左键点击菜单
							enableHeaderContextMenu : true, //此属性开启表头列名称右键点击菜单
							enableRowContextMenu : false
						});
		$("#search").click(function() {
			$grid.datagrid('load', getSearchConditions("#tt"));
		});
	});
	function viewHistory(taskid) {
		/* window.parent.addTab("processHistory","流程历史", "${ctx}/bpm/confForm/task-viewHistory?processInstanceId="
				+ processInstanceId); */
		window.parent.addTab("processHistory","流程历史", "${ctx}/bpm/confForm/form-viewHisPage?historyFlag=1&taskId="
				+ taskid);
	}
	function withdrawTask(taskId) {
		$.get("${ctx}/bpm/workspace/workspace-witwithdrawhdraw?taskId=" + taskId, function(data) {
			$grid.datagrid("load");
			$.messager.show({
				msg : data.msg,
				icon : "info",
				position : "bottomRight"
			});
		}, "json");
	}
</script>
</head>
<body>
	<div data-options="region:'center',fit:true,border:false">
		<table id="grid">
		</table>
		<div id="tt" class="row">
			<div class="col-md-12">
				<form class="form-grid-search form-inline">
					<div class="form-group">
						<input type="text" class="form-control"
							name="search_LIKE_processDefinitionId" placeholder="流程定义ID" />
					</div>
					<button type="button" id="search" class="btn btn-primary">
						<span class="glyphicon glyphicon-search"></span> 查询
					</button>
				</form>
			</div>
		</div>
	</div>
</body>
</html>
